﻿// -----------------------------------------------------------------------
// <copyright file="IFormsAuthentication.cs" company="CompDJ">
//     Copyright (c) CompDJ. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------

namespace CompDJ.Web.Abstractions
{
    using System;
    using System.Collections.Generic;
    using System.Collections.Specialized;
    using System.Linq;
    using System.Text;
    using System.Web;
    using System.Web.Configuration;
    using System.Web.Security;

    /// <summary>Forms authentication interface</summary>
    public interface IFormsAuthentication
    {
        string CookieDomain { get; }

        HttpCookieMode CookieMode { get; }

        bool CookiesSupported { get; }

        string DefaultUrl { get; }

        bool EnableCrossAppRedirects { get; }

        string FormsCookieName { get; }

        string FormsCookiePath { get; }

        bool IsEnabled { get; }

        string LoginUrl { get; }

        bool RequireSSL { get; }

        bool SlidingExpiration { get; }

        TicketCompatibilityMode TicketCompatibilityMode { get; }

        TimeSpan Timeout { get; }

        bool Authenticate(string name, string password);

        FormsAuthenticationTicket Decrypt(string encryptedTicket);

        void EnableFormsAuthentication(NameValueCollection configurationData);

        string Encrypt(FormsAuthenticationTicket ticket);

        HttpCookie GetAuthCookie(string userName, bool createPersistentCookie);

        HttpCookie GetAuthCookie(string userName, bool createPersistentCookie, string strCookiePath);
        
        string GetRedirectUrl(string userName, bool createPersistentCookie);

        string HashPasswordForStoringInConfigFile(string password, string passwordFormat);

        void Initialize();

        void RedirectFromLoginPage(string userName, bool createPersistentCookie);

        void RedirectFromLoginPage(string userName, bool createPersistentCookie, string strCookiePath);

        void RedirectToLoginPage();

        void RedirectToLoginPage(string extraQueryString);

        FormsAuthenticationTicket RenewTicketIfOld(FormsAuthenticationTicket tOld);

        void SetAuthCookie(string userName, bool createPersistentCookie);

        void SetAuthCookie(string userName, bool createPersistentCookie, string strCookiePath);

        void SignOut();
    }
}
